UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hBy83zNqiEoQfhwDHRqXm57/bFMFFMqFWfQ7slc7OuA='
WHERE
key_id = 'd04263be4913b83c6230638f5f5e09a70fb2d5e0ba4f10a23c026b766a94fe91'
AND (
token = 'hBy83zNqiEoQfhwDHRqXm57/bFMFFMqFWfQ7slc7OuA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)