UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kOkNyVl4pkBCC9ePPzCOYfjyolK/hzWCIwNixa9CgYY=' 
WHERE 
  key_id = '37fe819a10ff9a612a5f57480bd2540641d92bad42b91b6a07c5a911901bd997' 
  AND (
    token = 'kOkNyVl4pkBCC9ePPzCOYfjyolK/hzWCIwNixa9CgYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045