UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R6r9v6rUZjW1bqgnC9CvBIaIRbSpOnbj/6bJt6OeNYU=' 
WHERE 
  key_id = '2e6ae6d8aa2cd27122df55e246bf9636d2e869068546e4214283614967215c17' 
  AND (
    token = 'R6r9v6rUZjW1bqgnC9CvBIaIRbSpOnbj/6bJt6OeNYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028