UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HFu2QOQfXXR/ZgPkXAqS2ZYV5D6cUghegGAX0IVLf3M=' 
WHERE 
  key_id = '5b9c43aced7874b82bb1066c72c991a648c62b4b4ad72ede213b8009faf109a9' 
  AND (
    token = 'HFu2QOQfXXR/ZgPkXAqS2ZYV5D6cUghegGAX0IVLf3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043