UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tZwip0Aqke39FjuyCud5hqWClOH+wfsT3ITKrvERahg=' 
WHERE 
  key_id = '924b8b6546497533bd95020e48caaf631330943fae9df72fdfa38243405096a8' 
  AND (
    token = 'tZwip0Aqke39FjuyCud5hqWClOH+wfsT3ITKrvERahg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045