UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o+rR2WqN9a67yKMDx8YAxEUR7iwKlwnI0kwSI9ppxOY=' 
WHERE 
  key_id = '7c3c08dca645115928905c06380a88b671aeb76885a5fd26fa4a13e523981248' 
  AND (
    token = 'o+rR2WqN9a67yKMDx8YAxEUR7iwKlwnI0kwSI9ppxOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025