UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aHZWMPhIXS5qd7UsKXdMUVXq4cXrPfpZ2Qy4lmqW1cQ='
WHERE
key_id = 'adf8795f6cd1336bf64e236cffa733360d2654a8d9c23e7682d660184cc9518b'
AND (
token = 'aHZWMPhIXS5qd7UsKXdMUVXq4cXrPfpZ2Qy4lmqW1cQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)