UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hkeEX7v/SfkA0FDA3TuQaxXxeqFXBkFiQX0YaEWz/sY=' 
WHERE 
  key_id = 'e80586ef5e465390409d3de2a9043efe35b6ecd80e484930e991ef2675550759' 
  AND (
    token = 'hkeEX7v/SfkA0FDA3TuQaxXxeqFXBkFiQX0YaEWz/sY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040