UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oAZa/pFb/beIJWwvX7SjBIRMt8dyT8J845np7TzURaY='
WHERE
key_id = '2f590b0365645ca6f25aec0ca764e239abd66bb517ae8f85efb3b85672e8e94c'
AND (
token = 'oAZa/pFb/beIJWwvX7SjBIRMt8dyT8J845np7TzURaY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)