UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S1iDFgQBavB+YPN5me/GvY9twRh4dA0QfnLQXBmjkcw='
WHERE
key_id = '822c65874e80dde603aa1ff540d3782905622e05dda448a2d3bbf0e5850a89bd'
AND (
token = 'S1iDFgQBavB+YPN5me/GvY9twRh4dA0QfnLQXBmjkcw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)