UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9PibNWs+QAeaOVL6k55/2NRj8bvnw9TH1bn8p/POqY=' 
WHERE 
  key_id = 'df5b0aaab6480aa29d0cafe95af1923342854633e21ca88fcd367a97adbb7761' 
  AND (
    token = 'x9PibNWs+QAeaOVL6k55/2NRj8bvnw9TH1bn8p/POqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033