UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBDqRtB7R4iVxAOEO7DZNTOtioNbkE3mw8LbB2Arm40='
WHERE
key_id = '0d27bd3c0bed5e0841bd240794a68b0a52d4c7f0df1589b3542012f4987a4807'
AND (
token = 'cBDqRtB7R4iVxAOEO7DZNTOtioNbkE3mw8LbB2Arm40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)