UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1HfYQyp+xZUwqRqmeXm9n6H3e1UsWmlrt8hd7rUJ1nI=' 
WHERE 
  key_id = 'f87082a5907e6134d83d8cb403cc679b739d4fdaeac7029154d3739af6e68d51' 
  AND (
    token = '1HfYQyp+xZUwqRqmeXm9n6H3e1UsWmlrt8hd7rUJ1nI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041