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

Query time 0.00027