UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qj/8r/B8gqOxX+qs9gD9rWuE4eP/TXHu12YzGk5xNtg='
WHERE
key_id = '2af187650b2f4e1e319e18154be6385d5351afcc53fe82051538454187b1b78b'
AND (
token = 'qj/8r/B8gqOxX+qs9gD9rWuE4eP/TXHu12YzGk5xNtg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)