UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fi1RFwjLi3XtO6R5zbG+pA+iquIxoLSa3Z5BZ8n6+6Y='
WHERE
key_id = 'cd2cb7e893b82a5f7ef6289eccadfd61808b2bbb8284db54a8a0c008b9ea38c7'
AND (
token = 'fi1RFwjLi3XtO6R5zbG+pA+iquIxoLSa3Z5BZ8n6+6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)