UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CR0xzOMCui8bB6wFikLa8rejG6gEwgIH7xmtMSIdXj4='
WHERE
key_id = '9662bf38ab432f5f183926faaa87b0e6a4b498aac879d6794664a82ec28f8f50'
AND (
token = 'CR0xzOMCui8bB6wFikLa8rejG6gEwgIH7xmtMSIdXj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)