UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cl7IoCnri+TCpyfcNAnIwsv4rdu+k2aShx3GfLhppWE=' 
WHERE 
  key_id = 'ce04a69849188a1e9404f8cdff3237d5f57f6378504aa9049011d312398a6fd9' 
  AND (
    token = 'Cl7IoCnri+TCpyfcNAnIwsv4rdu+k2aShx3GfLhppWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020