UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9vO1cHDb+n6F3XjTRr1TCthptvooPDYbuApCHTp21Hs=' 
WHERE 
  key_id = 'ffbe777ed1ddea0aed95aadaabd27639e694c85c1c963e1e299fd7049aa2a313' 
  AND (
    token = '9vO1cHDb+n6F3XjTRr1TCthptvooPDYbuApCHTp21Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048