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