UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dvjmO+4PJgymjHfX4W4NQnlRe+AGwBGyhDM8eqVouAw='
WHERE
key_id = '4f49d2a4b56e01710b13b9b3dadeed846270736363edcd7ae9c66295ae192c8e'
AND (
token = 'dvjmO+4PJgymjHfX4W4NQnlRe+AGwBGyhDM8eqVouAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)