UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+0LV7QlX4pE6eFYiGMnpI58pcqlLftGyTWFFH1S+sk=' 
WHERE 
  key_id = 'f15e6ef2ddba06cd0b1be77e81c61feda2b0f2c7774e5f08ad6ac3c10d7a51cf' 
  AND (
    token = 'B+0LV7QlX4pE6eFYiGMnpI58pcqlLftGyTWFFH1S+sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032