UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OUWW8QxVlU2JnoeWz71QPBb9jzyLTKvZUPp2vPDfF2g=' 
WHERE 
  key_id = 'e2971128ce5019ce002d28b0b41dd462893b6b1718f6ed45345c0383cea9142c' 
  AND (
    token = 'OUWW8QxVlU2JnoeWz71QPBb9jzyLTKvZUPp2vPDfF2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037