UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FNp8BFxniy3G+jmjB3k8IXhAVDqHX7nFf6qD+9d2q7M=' 
WHERE 
  key_id = '9799470c760602f7a004bce4c863297a30987e681b31d9bc8820874530daa768' 
  AND (
    token = 'FNp8BFxniy3G+jmjB3k8IXhAVDqHX7nFf6qD+9d2q7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017