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

Query time 0.00054