UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rLZDvDRF+3Hz0xqhlzeC4NgJJPVHLSOyYcp33y0bY+I=' 
WHERE 
  key_id = '749318a365af56d7d4dd5bb4223c9fb29284ffea3b7e325598e58714bf14956d' 
  AND (
    token = 'rLZDvDRF+3Hz0xqhlzeC4NgJJPVHLSOyYcp33y0bY+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043