UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xy8in9coQyTMrdD2ZXixRCUA4UymG7mZ/3gFRaO2ztM='
WHERE
key_id = 'd9c41839dcaf84684ac577a4ce51fd55604845d29bfd7f8c2e26a97e81d46780'
AND (
token = 'xy8in9coQyTMrdD2ZXixRCUA4UymG7mZ/3gFRaO2ztM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)