UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecLjzyG9ctSmdYzpQ8EtRS7UmKeoa7wevAUE39zQlsU=' 
WHERE 
  key_id = 'a24c6026dd43bc3f93dc283f18d5d696f167c1f10b016a78183e81399df5cb87' 
  AND (
    token = 'ecLjzyG9ctSmdYzpQ8EtRS7UmKeoa7wevAUE39zQlsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020