UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P3tznVI5S+Tj7qoeEN/WvB7PjxD2tjlLgb6WAHd4XJ0='
WHERE
key_id = 'e3ccfa0780a25411f1af30185076257a66fbe371d5205dfe8b2fa61f561e198d'
AND (
token = 'P3tznVI5S+Tj7qoeEN/WvB7PjxD2tjlLgb6WAHd4XJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)