UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G76E+cqJ90hRyICZhgxuetSmTXKKnGW4W4K06kjlgrw='
WHERE
key_id = 'c6ed59d16095a6dd33068f809e21179fcef3d4a3ec1dd3b6a531ea9aff6876f0'
AND (
token = 'G76E+cqJ90hRyICZhgxuetSmTXKKnGW4W4K06kjlgrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)