UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kprskkKUcCJi2I0hSH0ryK4fscOdAoP4oCAwoUIn25g=' 
WHERE 
  key_id = '6984d6cc2b9e91a6e9761e7cbb62e517736649c8c625363053dd0300425625b9' 
  AND (
    token = 'kprskkKUcCJi2I0hSH0ryK4fscOdAoP4oCAwoUIn25g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039